#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author   : Moty
# @Time     : 2024/10/18 16:52
# @File     : kc16_19.py
# @Project  : CSPT
def parse_19_Charging_End(body):
    # 解析0x19 充电结束
    data = {
        "交易流水号": f"{body[0:32]}({body[0:32]})",
        "桩编号": f"{body[32:46]}({body[32:46]})",
        "枪号": f"{int(body[46:48], 16)}枪({body[46:48]})",
        "BMS 中止荷电状态 SOC": f"{int(body[48:50],16)}% (0~100%)({body[48:50]})",
        "BMS 动力蓄电池单体最低电压": f"{int(body[50:54],16)/100}V (0~24V)({body[50:54]})",
        "BMS 动力蓄电池单体最高电压": f"{int(body[54:58],16)/100}V (0~24V)({body[54:58]})",
        "BMS 动力蓄电池最低温度": f"{int(body[58:60],16)-50}ºC(-50ºC偏移量 数据范围:-50ºC~200ºC)({body[58:60]})",
        "BMS 动力蓄电池最高温度": f"{int(body[60:62],16)-50}ºC(-50ºC偏移量 数据范围:-50ºC~200ºC)({body[60:62]})",
        "电桩累计充电时间": f"{int(body[62:66],16)}min (范围:0~600 min)({body[62:66]})",
        "电桩输出能量": f"{int(body[66:70],16)/10}kWh(范围：0~1000 kWh)({body[66:70]})",
        "电桩充电机编号": f"{int(body[70:78],16)-1}(1偏移量 范围：0~0xFFFFFFFF)({body[70:78]})",
    }
    formatted_data = ""
    for key, value in data.items():
        formatted_data += f"{key}: {value}\n"
    return formatted_data


__all__ = ['parse_19_Charging_End']
